<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
require_once(APP_PATH."/Lib/ORG/t.class.php");
require_once(APP_PATH."/Lib/ORG/Mycurl.class.php");
$c=new Mycurl();
$url=urldecode($_REQUEST['url']);
$c->result("",$url);
$tc=preg_replace("/^.*\?tc=/","",$_REQUEST['imgsrc']);
$nn=explode(",",$_REQUEST['only']);
$Querystring="";
for($i=0;$i<count($nn);$i++){
    $Querystring.="{$nn[$i]}=".$_REQUEST[$nn[$i]]."&";
}
$Querystring=substr($Querystring,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_REQUEST['action']);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, $_REQUEST['referer']);
curl_setopt($ch, CURLOPT_COOKIE,$c->cookie);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $Querystring);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, "false");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, "2");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_VERBOSE,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host:  {$c->qhost}","Connection:  keep-alive","Accept:  application/json, text/javascript, */*; q=0.01","Origin:  https://weixin.sogou.com","X-Requested-With:  XMLHttpRequest","Content-Type:  application/x-www-form-urlencoded; charset=UTF-8","Accept-Language:  en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7","Cache-Control: no-cache","Pragma: no-cache","Sec-Fetch-Mode: cors","Sec-Fetch-Site: same-origi"));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result=curl_exec($ch);
curl_close($ch);
$c->result($result,$url);
$body=$c->body;
$data=json_decode($body,1);
$body=preg_replace("/\"code\"/Uisx","\"regCode\"",$body);
$body=preg_replace("/\"msg\"/Uisx","\"regMsg\"",$body);

$inifile = $_SERVER['DOCUMENT_ROOT'] . "/collect/Lib/CollcetLib/" . $c->host . ".yzmhou.php";
if (is_file($inifile)) {
    include($inifile);
}
echo $body;
